// services/order.js
import { request } from '@umijs/max';

export async function fetchOrderList(data) {
  const req = await request('/api/mjOrder/queryByPage', {method: 'POST', data });
  return {data:req.data.records,success:true,total:req.data.total}
}

export async function createOrder(data) {
  return request('/api/mjOrder/add', { method: 'POST', data });
}
// 订单详情
export async function fetchOrderDetail(id) {
  return request(`/api/mjOrder/detail`, { method: 'GET', params: {id:id} });
}
export async function updateOrder(data) {
  return request(`/api/mjOrder/edit`, { method: 'PUT', data });
}

export async function deleteOrder(id) {
  return request(`/api/mjOrder/delete`, { method: 'DELETE' });
}
export async function editAmount(params) {
  return request(`/api/mjOrder/editAmount`, { method: 'GET', params });
}
export async function updateOrderAmount(params) {
  return request(`/api/mjOrder/editAmount`, { method: 'GET', params });
}

export async function updateAudit(id) {
  return request(`/api/mjOrder/shenhe`, { method: 'GET', params: {id:id}});
}
export async function updateOrderDetail(data) {
  return request(`/api/mjOrder/updateOrderDetail`, { method: 'POST', data});
}
export async function updateTokenStatus(data) {
  return request(`/api/mjOrder/updateTokenStatus`, { method: 'POST', data}); 
}